<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*"%>
<jsp:include page="common/header.jsp"></jsp:include>
<%
	UserSession usersession = (UserSession)session.getAttribute("user");

	String connGroup 	= "";
	String user_id 		= "";
	if(usersession!=null){
		connGroup 	= CmmUtil.nvl(usersession.getConnGroup(),"0");
		user_id 	= CmmUtil.nvl(usersession.getUser_id(),"");
	}
	
	String present_Year = String.valueOf(GregorianCalendar.getInstance().get(Calendar.YEAR));
	String ent_id		= (String)session.getAttribute("ent_id");
	String cate_id = CmmUtil.nvl(request.getParameter("cate_id"),"");
	String cate_gubun = CmmUtil.nvl(request.getParameter("cate_gubun"),"");
	String lrg_cate = CmmUtil.nvl(request.getParameter("lrg_cate"),"");
	String mid_cate = CmmUtil.nvl(request.getParameter("mid_cate"),"");
	String sml_cate = CmmUtil.nvl(request.getParameter("sml_cate"),"");
	request.setAttribute("lrg_cate",lrg_cate);
	
	String selected_year 	= CmmUtil.nvl(request.getParameter("selectYear"),present_Year);
	
	HashMap map = new HashMap();
	HashMap map1 = null;
	ArrayList list = new ArrayList();
	CommonDaoService commonservice = new CommonDaoService("Com0302lp01Dao");
	map.put("cate_id",cate_id);
	map.put("cate_gubun",cate_gubun);
	map.put("ent_id",ent_id);
	
	list = (ArrayList)commonservice.commonDaoMethod(map);
//OpenFlash 관련 start
	String send_values ="";
	
	send_values = "yyyy=" + selected_year + "&lrg_cate=" + lrg_cate + "&mid_cate=" + mid_cate + "&sml_cate="+ sml_cate +"&ent_id=" + ent_id+"&user_id=" + user_id;

	String base = request.getContextPath() + "/flash/";
	int width = 700;
	int height = 250;

	String dataurl 	="";
	String data_url ="";
	String url		="";

	String obj_id = "chart";

	dataurl = request.getRequestURL().toString();
	data_url = "/jsp/com0302l_p02.jsp?" + send_values;

	url = java.net.URLEncoder.encode(dataurl.replace(request.getContextPath() +"/jsp/com0302l_p01.jsp", 
		request.getContextPath() + data_url), "EUC-KR"); //openFlash로 넘길 URL 인코딩

//OpenFlash 관련 End
	int Year = GregorianCalendar.getInstance().get(Calendar.YEAR);

%>
<script language='javascript' src="/js/ajaxutil.js"></script>
<script>
	function init(){ 
	    form = document.frm1;
	  
	    setCateList(form.lrg_cate,'<%=lrg_cate%>', '선택', '000|lrg');
	    setCateList(form.mid_cate,'<%=mid_cate%>', '선택', '<%=lrg_cate%>|mid');
		setCateList(form.sml_cate,'<%=sml_cate%>', '선택', '<%=mid_cate%>|sml');
	}
	function search_statistics(){
		var frm = document.frm1;
		frm.method ="post";
		frm.target ="_self";
		frm.action ="com0302l_p01.jsp";
		frm.submit();
	}
	
	function excel_down(){
		var frm = document.frm1;
		frm.method ="post";
		frm.target ="_self";
		frm.action ="com0302l_p01_excel.jsp";
		frm.submit();
	}
	
	function change_midCate(){
		var frm = document.frm1;
		frm.method ="post";
		frm.target ="hide_src";
		frm.action ="com0302l_p03.jsp";
		frm.submit();
	}
	function go_change_cate(v, gu){
		var frm = document.frm1;
		
		if(gu == "lrg"){
			setCateList(form.mid_cate,'', '선택', v+'|mid');
			setCateList(form.sml_cate,'', '선택', '');			
		}else if(gu== "mid"){
			setCateList(form.sml_cate,'', '선택', v+'|sml');
		}else if(gu== "sml"){
		}

		frm.cate_id.value = v;
		frm.cate_gubun.value = gu;

		//setPoiList(form.poi_nm_select,'', '과정선택', v,gu,start_dt,close_dt);
	}
</script>
<body onload="init()">
<table width="992" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>
	<!--top -->
    <jsp:include page="common/top_menu.jsp"></jsp:include> 
    <!-- //top -->
    <!-- contents area -->
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="180" valign="top">
    	<jsp:include page="left/com0301l_p05.jsp"></jsp:include>
    </td>
    <td width="21" valign="top">&nbsp;</td>
    <td valign="top" style="margin:0 0 15px 0;">
    
<form name="frm1">
	<input type="hidden" name="ent_id" value="<%=ent_id %>">
	<input type="hidden" name="cate_id" value="<%=cate_id %>">
	<input type="hidden" name="cate_gubun" value="<%=cate_gubun %>">
    	 <table width="790px"  border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td style="font-size:14px; color:#3b70a2; font-weight:bold; border-bottom:2px solid #c8c8c8; padding:0 0 5px 0;" align="left"><img src="/images/sub_icon1.jpg"  alt="" border="0">&nbsp;접속통계 - 수료통계</td>
            </tr>
        </table>
        <table width="790px"  border="0" cellpadding="0" cellspacing="0" style="margin:5px 0 0 0;">
        	<tr>
             <td align="left"><!--  <img src="/images/btn_save_excel1.gif" align="absmiddle"  onclick="excel_down()"/> --></td>
             <td align="right"> 
             	  <select name="lrg_cate" onchange="go_change_cate(this.value, 'lrg');"> </select>
                  <select name="mid_cate" onchange="go_change_cate(this.value, 'mid');"></select>
				  <select name="sml_cate" onchange="go_change_cate(this.value, 'sml');"></select>
			  	 <select name="selectYear">
			  	 	<%for(int i=0; i<3; i++){ %>
                    <option value="<%=Year-i%>" <%if((String.valueOf(Year-i)).equals(selected_year)){%> selected <%}%> ><%=Year-i%></option>
                    <%} %>
                 </select>
					년
                 <a href="javascript:search_statistics()"><img src="/images/bt_search2.gif" align="absmiddle" /></a>             
              </td>
			</tr>
        </table>
</form>

         <table width="100%" border="0" cellpadding="0" cellspacing="0"  style="margin:5px 0 10px 0; padding:10px 0 10px 0; border:1px solid #cfcfcf;">
           <tr>
             <td align="center" colspan="12"> 
             
<!-- 그래프 -->
<div class="score-subject-div"> 
	<div class="subject-value">
		<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
			codebase="<%= request.getProtocol() %>://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
			width="<%=width %>" height="<%=height %>" id="ie_<%=obj_id %>" align="middle">
				<param name="allowScriptAccess" value="sameDomain" />
				<param name="movie" value="<%=base%>open-flash-chart.swf?width=<%=width%>&height=<%=height%>&data=<%=url%>" />
				<param name="quality" value="high" />
				<param name="bgcolor" value="#FFFFFF" />
				<embed src="<%=base%>open-flash-chart.swf?data=<%=url%>" quality="high" bgcolor="#FFFFFF" width="<%=width%>" height="<%=height%>" name="<%=obj_id%>" align="middle" allowScriptAccess="sameDomain"
					type="application/x-shockwave-flash" pluginspage="<%=request.getProtocol()%>://www.macromedia.com/go/getflashplayer" id="<%=obj_id%>"/>
		</object>
	</div>
</div>
<!-- //그래프 -->    
         
              </td>
           </tr>
           <tr>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           	<td align="right" style="color:#EEC5BB"><img src="/images/studing.bmp">&nbsp;&nbsp;<b>수료자</b></td>
           	<td style="color:#CAD5D0">&nbsp;&nbsp;&nbsp;<img src="/images/ending.bmp">&nbsp;&nbsp;<b>학습자</b></td>
           	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
           </tr>
         </table>
        </td>
  </tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-top:2px solid #c8c8c8;" align="left">
    	<tr>
        	<td align="left"><img src="/images/copyright_hrd.gif"  alt="" border="0" /></td>
        </tr>
</table>
	</td>
  </tr>
</table>
<iframe name='hide_src' src ="com0302l_p03.jsp" width='0' height='0' SCROLLING='AUTO' frameborder='0'></iframe>
</body>
</html>
